<template>
  <div
    class="banner"
    :style="{
      backgroundColor: config.pageConfig.color,
    }"
  >
    <div
      :style="{
        marginTop: config.pageConfig.marginTop + 'px',
        marginBottom: config.pageConfig.marginBottom + 'px',
        marginLeft: config.pageConfig.margin + 'px',
        marginRight: config.pageConfig.margin + 'px',
        borderTopLeftRadius: config.pageConfig.radiusTop + 'px',
        borderTopRightRadius: config.pageConfig.radiusTop + 'px',
      }"
    >
      <div
        class="img"
        :style="{
          borderTopLeftRadius: config.pageConfig.radiusTop + 'px',
          borderTopRightRadius: config.pageConfig.radiusTop + 'px',
          borderBottomLeftRadius: config.pageConfig.radiusBottom + 'px',
          borderBottomRightRadius: config.pageConfig.radiusBottom + 'px',
        }"
      >
        <div
          v-for="(item, idx) in config.pageConfig.imgList"
          :style="{
            backgroundColor: config.pageConfig.listcolor,
            borderColor: config.pageConfig.linecolor,
          }"
          :key="idx"
        >
          <div class="picture-img-contain">
            <span
              v-if="
                config.pageConfig.iconshow &&
                config.pageConfig.imgList[idx].imgUrl
              "
              :style="{
                fontSize: config.pageConfig.textSize + 'px',
                color: config.pageConfig.iconcolor,
              }"
              class="iconfont"
              :class="'icon-' + item.imgUrl"
            ></span>
            <span
              :style="{
                fontSize: config.pageConfig.textSize + 'px',
                color: config.pageConfig.iconcolor,
              }"
              v-else-if="config.pageConfig.iconshow"
              class="iconfont icon-copy-document"
            ></span>
            <p
              :style="{
                fontSize: config.pageConfig.textSize + 'px',
                color: config.pageConfig.textcolor,
              }"
            >
              {{ config.pageConfig.imgList[idx].title }}
            </p>
          </div>
          <span
            :style="{
              fontSize: config.pageConfig.textSize + 'px',
              color: config.pageConfig.textcolor,
            }"
            class="iconfont icon-arrow-right"
          ></span>
        </div>
      </div>
    </div>
  </div>
</template>
<script lang="ts">
export default {
  name: "Image",
};
</script>
<script lang="ts" setup>
import { reactive, onMounted } from "vue";
const config = defineProps({
  pageConfig: {
    type: Object,
    default: {
      iconshow: true,
      color: "transparent",
      listcolor: "#fff",
      iconcolor: "#999999",
      textcolor: "#999999",
      linecolor: "#ededed",
      textSize: 14,
      marginTop: 0,
      marginBottom: 0,
      margin: 10,
      radiusTop: 0,
      radiusBottom: 0,
      imgList: [
        {
          title: "文字",
          imgUrl: "",
          name: "",
          url: "",
        },
        {
          title: "文字",
          imgUrl: "",
          name: "",
          url: "",
        },
        {
          title: "文字",
          imgUrl: "",
          name: "",
          url: "",
        },
      ],
    },
  },
});
let emits = defineEmits<{ (e: "close", flag: boolean): void }>();
</script>
<style lang="scss" scoped>
.banner {
  width: 100%;
  overflow: hidden;
}
.img {
  width: 100%;
  overflow: hidden;
  > div {
    width: 100%;
    padding: 0 24px;
    border-bottom: 1px solid #ededed;
    height: 50px;
    display: flex;
    align-items: center;
    font-size: 14px;
    color: #333;
    box-sizing: border-box;
    .picture-img-contain {
      width: 100%;
      display: flex;
      align-items: center;
      img {
        width: 16px;
        height: 16px;
        margin-right: 10px;
      }
      .el-icon,
      .iconfont {
        font-size: 16px;
        margin-right: 10px;
      }
      p {
        flex: 1;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
    }
    :deep(.el-icon) {
      font-size: 16px;
    }
    .iconfont {
      font-size: 16px;
    }
  }
}
</style>
